package com.example.day03.ex04;

import java.util.Random;
import java.util.Scanner;

public class RandomTest {
    public static void main(String[] args) {
        Random r=new Random();
        int number=r.nextInt(100)+1;
        while (true){
            Scanner sc=new Scanner(System.in);
            System.out.println("请输入你猜的数：");
            int guess=sc.nextInt();
            if (guess>number){
                System.out.println("猜大了");
            }else if (guess<number){
                System.out.println("猜小了");
            }else {
                System.out.println("恭喜你猜对了");
                break;
            }
        }
    }
}
